package com.syni.mdd.yhd.common.all.service.impl.user;

import com.syni.mdd.yhd.common.all.dao.jpa.user.BmsUserBlacklistDao;
import com.syni.mdd.yhd.common.all.dao.jpa.user.BmsUserRegisterDisasterDao;
import com.syni.mdd.yhd.common.all.entity.user.BmsUserBlacklist;
import com.syni.mdd.yhd.common.all.entity.user.BmsUserRegisterDisaster;
import com.syni.mdd.yhd.common.all.service.impl.BaseService;
import com.syni.mdd.yhd.common.all.service.user.BmsUserBlacklistService;
import com.syni.mdd.yhd.common.all.service.user.BmsUserRegisterDisasterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * @className
 * @description TOO
 * @Author cfx
 * @DATE 2019/4/9 12:04
 * @VERSION 1.0
 **/
@Service
public class BmsUserBlacklistServiceImpl extends BaseService<BmsUserBlacklist,Integer> implements BmsUserBlacklistService {
    @Autowired
    BmsUserBlacklistDao bmsUserBlacklistDao;

    @Override
    public BmsUserBlacklistDao getBaseDao() {
        return bmsUserBlacklistDao;
    }

    @Override
    public void addUser(Integer userId) {
        BmsUserBlacklist bmsUserBlacklist = bmsUserBlacklistDao.findByUserId(userId);
        if(bmsUserBlacklist == null){
            bmsUserBlacklist = new BmsUserBlacklist();
            bmsUserBlacklist.setUserId(userId);
            bmsUserBlacklist.setNewTime(new Date());
            bmsUserBlacklistDao.save(bmsUserBlacklist);
        }
    }
}
